package initialize

import (
	"api/global"
	"errors"
	"fmt"
	"github.com/elastic/go-elasticsearch"
)

func InitEs() {
	var err error
	cfg := elasticsearch.Config{
		Addresses: []string{
			"http://121.36.228.151:9200",
		},
	}
	global.EsDB, err = elasticsearch.NewClient(cfg)
	if err != nil {
		panic(errors.New("es 链接失败"))
	}
	fmt.Println("es 链接成功")
	// ...
}
